package com.wish.g1.contract.listener;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.listener.AcknowledgingMessageListener;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.stereotype.Component;


@Component
public class ContractListener implements AcknowledgingMessageListener<String,String> {


    @KafkaListener(topics = "wish")
    @Override
    public void onMessage(ConsumerRecord<String, String> consumerRecord, Acknowledgment acknowledgment) {
        System.err.println("=======kafka========");
        System.err.println("接收到的消息是:"+consumerRecord.value());

        acknowledgment.acknowledge();
    }
}
